﻿{extend name="public/base" /}
{block name="style"}
<style>
    .content-box .form{border: 1px solid #e9e9e9;    padding-bottom: 20px;}
    .content-box .tabBar{border-bottom: 1px solid #e9e9e9;}
</style>
{/block}
{block name="content"}
<div class="page-container">
<div class="content-box">
	<form class="form form-horizontal" action="{:url('Config/oauth')}" method="post" id="form">
		<div id="tab-system" class="HuiTab">
			<div class="tabBar cl"><span>QQ登录接口</span><span>微博登录接口</span></div>
			<!--taobao-oauth-start-->
            <div class="tabCon">
                <div class="pd-10  margin-top-15">
                    网站名称: <span class="c-success mr-5">{WEB_SITE_NAME}</span> 分类名称: <span class="c-primary mr-5">{cate_name}</span> 分类Title: <span class="c-primary mr-5">{oauth_title}</span> 分类Keywords: <span class="c-primary mr-5">{oauth_keywords}</span> 分类Description: <span class="c-primary mr-5">{oauth_description}</span>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">App Key：</label>
                    <div class="formControls col-xs-8 col-sm-6">
                        <input type="text" id="website-url" name="oauth[qq][key]" placeholder="比如：http://www.chengxuxia.com" value="{$oauth['qq']['key'] ?? ''}" class="input-text">
                    </div>
                    <div class="col-xs-3 col-sm-3"><span class="label label-success radius" style="padding:4px;">必须以http://开头，/结尾</span></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">App Secret: </label>
                    <div class="formControls col-xs-8 col-sm-6">
                        <input type="text" id="website-title" name="oauth[qq][secret]" placeholder="比如：程序侠" value="{$oauth['qq']['secret'] ?? ''}" class="input-text">
                    </div>
                </div>
            </div>

            <!--weibo-oauth-start-->
            <div class="tabCon">
                <div class="pd-10  margin-top-15">
                    网站名称: <span class="c-success mr-5">{WEB_SITE_NAME}</span> 分类名称: <span class="c-primary mr-5">{cate_name}</span> 分类Title: <span class="c-primary mr-5">{oauth_title}</span> 分类Keywords: <span class="c-primary mr-5">{oauth_keywords}</span> 分类Description: <span class="c-primary mr-5">{oauth_description}</span>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">程序侠 Key：</label>
                    <div class="formControls col-xs-8 col-sm-6">
                        <input type="text" id="website-url" name="oauth[weibo][key]" placeholder="比如：http://www.chengxuxia.com" value="{$oauth['weibo']['key'] ?? ''}" class="input-text">
                    </div>
                    <div class="col-xs-3 col-sm-3"><span class="label label-success radius" style="padding:4px;">必须以http://开头，/结尾</span></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">程序侠 Secret:</label>
                    <div class="formControls col-xs-8 col-sm-6">
                        <input type="text" id="website-title" name="oauth[weibo][secret]" placeholder="比如：程序侠" value="{$oauth['weibo']['secret'] ?? ''}" class="input-text">
                    </div>
                </div>
            </div>
			
		</div>
		<div class="row cl mt-20">
			<div class="col-xs-8 col-sm-6 col-xs-offset-4 col-sm-offset-3">
				<button class="btn btn-success mr-20 radius-rounded" type="submit">&nbsp;<i class="Hui-iconfont">&#xe6a7;</i> 保存</button>
                <button type="button" class="btn btn-default radius-rounded" onclick="layer_close();">&nbsp;<i class="Hui-iconfont">&#xe6a6;</i> 取消&nbsp;</button>
			</div>
		</div>
	</form>
</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/uploadify/jquery.uploadify.min.js?123"></script> 
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-green',
            radioClass: 'iradio-green',
            increaseArea: '20%'
        });
	$.Huitab("#tab-system .tabBar span","#tab-system .tabCon","current","click","0");
	$("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
    });
});
</script>
<script type="text/javascript">
$("#upload_site_logo").uploadify({
    "height"          : 30,
    "swf"             : "__LIB__/uploadify/uploadify.swf",
    "fileObjName"     : "image",
    "buttonText"      : "上传图片",
    "uploader"        : "{:url('Config/ajaxUploadImg')}",
    "width"           : 100,
    'removeTimeout'	  : 1,
    'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
    "onUploadSuccess" : uploadSiteLogo,
    'onFallback' : function() {
    	layer.msg('未检测到兼容版本的Flash', {icon: 2, time: 3000}); 
    }
});
function uploadSiteLogo(file, data){ 
    var data = $.parseJSON(data);
    var src = '';
    if(data.code){
    	src = '__ROOT__/' + data.data
    	$("input[name=WEB_SITE_LOGO]").val(data.data);
    	$("#preview_site_logo").removeClass('hide');
    	$("#url_site_logo").attr('src',src);

    } else { 
        layer.msg(data.msg, {icon: 2, time: 3000}); 
    }
}

$("#upload_goods_bgimg").uploadify({
    "height"          : 30,
    "swf"             : "__LIB__/uploadify/uploadify.swf",
    "fileObjName"     : "image",
    "buttonText"      : "上传图片",
    "uploader"        : "{:url('Config/ajaxUploadImg')}",
    "width"           : 100,
    'removeTimeout'	  : 1,
    'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
    "onUploadSuccess" : uploadGoodsBgimg,
    'onFallback' : function() {
    	layer.msg('未检测到兼容版本的Flash', {icon: 2, time: 3000}); 
    }
});
function uploadGoodsBgimg(file, data){ 
    var data = $.parseJSON(data);
    var src = '';
    if(data.code){
    	src = '__ROOT__/' + data.data
    	$("input[name=WEB_GOODS_BGIMG]").val(data.data);
    	$("#preview_goods_bgimg").removeClass('hide');
    	$("#url_goods_bgimg").attr('src',src);

    } else { 
        layer.msg(data.msg, {icon: 2, time: 3000}); 
    }
}

$("#upload_weixin_img").uploadify({
    "height"          : 30,
    "swf"             : "__LIB__/uploadify/uploadify.swf",
    "fileObjName"     : "image",
    "buttonText"      : "上传图片",
    "uploader"        : "{:url('Config/ajaxUploadImg')}",
    "width"           : 100,
    'removeTimeout'	  : 1,
    'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
    "onUploadSuccess" : uploadWeixinImg,
    'onFallback' : function() {
    	layer.msg('未检测到兼容版本的Flash', {icon: 2, time: 3000}); 
    }
});
function uploadWeixinImg(file, data){ 
    var data = $.parseJSON(data);
    var src = '';
    if(data.code){
    	src = '__ROOT__/' + data.data
    	$("input[name=WEB_WEIXIN_IMG]").val(data.data);
    	$("#preview_weixin_img").removeClass('hide');
    	$("#url_weixin_img").attr('src',src);

    } else { 
        layer.msg(data.msg, {icon: 2, time: 3000}); 
    }
}

</script>
{/block}